Skip to content

Fix on delete cascade entity order#20949

Merged
jeremystretch merged 2 commits intonetbox-community:mainfrom
fanshan:fix_on_delete_order
Dec 22, 2025
Merged

Fix on delete cascade entity order#20949
jeremystretch merged 2 commits intonetbox-community:mainfrom
fanshan:fix_on_delete_order

Conversation

@fanshan
Copy link
Contributor

@fanshan fanshan commented Dec 8, 2025

Hello,

Since #20708 relation with a on delete RESTRICT are not deleted in the proper order. Then the error violate not-null constraint occurs and breaks the delete cascade feature.

Fixes: #20948

This PR try to fix object on delete order when a relation was set with the action RESTRICT on delete event.

Since [netbox-community#20708](netbox-community#20708)
relation with a on delete RESTRICT are not deleted in the proper order.
Then the error `violate not-null constraint` occurs and breaks the
delete cascade feature.
@jeremystretch jeremystretch requested review from a team and jeremystretch and removed request for a team and jeremystretch December 9, 2025 13:49
@jeremystretch
Copy link
Member

Per our contributing guide, please don't submit a PR for an issue until it has been accepted and assigned to you for work.

@jnovinger jnovinger requested review from a team and jeremystretch and removed request for a team December 19, 2025 22:57
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanshan please avoid including unrelated and unnecessary changes when submitting a PR. The only relevant change here is on line 224.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fanshan!

@jeremystretch jeremystretch merged commit 3acbb0a into netbox-community:main Dec 22, 2025
7 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On delete order was breaked with RESTRICT action

2 participants